Use the monitor the window currently is on, not always the primary
authorTor Lillqvist <tml@novell.com>
Sun, 25 Nov 2007 22:59:50 +0000 (22:59 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Sun, 25 Nov 2007 22:59:50 +0000 (22:59 +0000)
2007-11-26  Tor Lillqvist  <tml@novell.com>

* gdk/win32/gdkwindow-win32.c (gdk_window_fullscreen): Use the
monitor the window currently is on, not always the primary
monitor. (#463865, Tim Evans)

svn path=/trunk/; revision=19047

ChangeLog
gdk/win32/gdkwindow-win32.c

index b6ac1a721552b424f4df348eb47d269ae45b8a0e..fc871de6f1b100985049556fc4cb12326c8caa4f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-11-26  Tor Lillqvist  <tml@novell.com>
+
+       * gdk/win32/gdkwindow-win32.c (gdk_window_fullscreen): Use the
+       monitor the window currently is on, not always the primary
+       monitor. (#463865, Tim Evans)
+
 2007-11-26  Tor Lillqvist  <tml@novell.com>
 
        * gdk/win32/gdktestutils-win32.c: New file, dummy implementations.
index 51db1c1669975ccb7c39e9a010b530de7fb0a744..4fd8ce7a86f17a0882af5c89e9af6eb519f8396e 100644 (file)
@@ -3313,9 +3313,11 @@ struct _FullscreenInfo
 void
 gdk_window_fullscreen (GdkWindow *window)
 {
-  gint width, height;
+  gint x, y, width, height;
   FullscreenInfo *fi;
   GdkWindowObject *private = (GdkWindowObject *) window;
+  HMONITOR monitor;
+  MONITORINFO mi;
 
   g_return_if_fail (GDK_IS_WINDOW (window));
 
@@ -3327,9 +3329,22 @@ gdk_window_fullscreen (GdkWindow *window)
     {
       GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
 
-      width = GetSystemMetrics (SM_CXSCREEN);
-      height = GetSystemMetrics (SM_CYSCREEN);
+      monitor = MonitorFromWindow (GDK_WINDOW_HWND (window), MONITOR_DEFAULTTONEAREST);
+      mi.cbSize = sizeof (mi);
+      if (monitor && GetMonitorInfo (monitor, &mi))
+       {
+         x = mi.rcMonitor.left;
+         y = mi.rcMonitor.top;
+         width = mi.rcMonitor.right - x;
+         height = mi.rcMonitor.bottom - y;
+       }
+      else
+       {
+         x = y = 0;
+         width = GetSystemMetrics (SM_CXSCREEN);
+         height = GetSystemMetrics (SM_CYSCREEN);
+       }
+
       /* remember for restoring */
       fi->hint_flags = impl->hint_flags;
       impl->hint_flags &= ~GDK_HINT_MAX_SIZE;
@@ -3340,7 +3355,7 @@ gdk_window_fullscreen (GdkWindow *window)
                      (fi->style & ~WS_OVERLAPPEDWINDOW) | WS_POPUP);
 
       API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOP,
-                              0, 0, width, height,
+                              x, y, width, height,
                               SWP_NOCOPYBITS | SWP_SHOWWINDOW));
 
       gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN);